package com.zcx.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcx.mapper.RoleMapper;
import com.zcx.mapper.TestMapper;
import com.zcx.pojo.Role;
import com.zcx.pojo.TestDatasource;
import com.zcx.service.IRoleService;
import com.zcx.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhaochangxin
 * @Title: TestServiceImpl
 * @Package com.zcx.service.impl
 * @Description: TestServiceImpl
 * @date 2022/4/2 10:43
 */
@Service
@DS("slave")
public class TestServiceImpl extends ServiceImpl<TestMapper, TestDatasource> implements TestService {
    @Autowired
    TestMapper testMapper;
    @Override
    @DS("slave_2")
    public List<TestDatasource> queryAllTestFromSlave_2() {
        return testMapper.selectList(null);
    }

    @Override
    @DS("slave_1")
    public List<TestDatasource> queryAllTestFromSlave_1() {
        return testMapper.selectList(null);
    }

    @Override
    @DS("master")
    public List<TestDatasource> queryAllTestFromMaster() {
        return testMapper.selectList(null);
    }

    @Override
    public List<TestDatasource> queryAllTestPrimary() {
        return testMapper.selectList(null);
    }
}
